<template>
  <div class="unpopular-statistics bg-white font30 text-center">
    <div class="bg-light-red header">
      <div class="font30">
        花仙子60<span class="red">5555</span>.com【冷门统计】
      </div>
    </div>
    <div class="sub-title">
      <span class="bg-yellow red font-bolder"
        >截止到{{ data.period }}期各类统计</span
      >
    </div>
    <div v-if="loaded">
      <!-- 最冷特肖统计 -->
      <coldest-shaw :coldestShaw.sync="data.coldestShaw" />
      <!-- 最冷特尾统计 -->
      <coldest-special :coldestSpecial.sync="data.coldestSpecial" />
      <!-- 综合各类统计 -->
      <all-kinds :allKinds.sync="data.allKinds" />
    </div>
  </div>
</template>

<script setup>
import ColdestShaw from "./UnpopularStatistics/ColdestShaw.vue";
import ColdestSpecial from "./UnpopularStatistics/ColdestSpecial.vue";
import AllKinds from "./UnpopularStatistics/AllKinds.vue";
import { onMounted, reactive } from "vue";
import { getApiUnpopularStatisticsData } from "@/api/api";
const data = reactive({  
  loaded: false,
  period: "279",
  coldestShaw: {},
  coldestSpecial: {},
  allKinds: {},
});
onMounted(() => {
  getUnpopularStatisticsData();
});
const getUnpopularStatisticsData = () => {
  getApiUnpopularStatisticsData().then((res) => {
    data.period = res.period
    data.coldestShaw = { ...res.coldestShaw }
    data.coldestSpecial = { ...res.coldestSpecial }
    data.allKinds = { ...res.allKinds }
    setTimeout(() => {
      data.loaded = true
    })
  });
};
</script>

<style lang="less" scoped>
.header {
  padding: 5px 0;
}
.sub-title {
  margin: 5px 0;
}
</style>
